

*------------------------------------------------------------------------------------
* Table E31 -- Heterogeneity in Profit Impacts
*------------------------------------------------------------------------------------

local num = 0
foreach var in h_female h_domain9 h_network h_mentor_profit h_mentor_exp h_mentor_dist {
	local ++num
	gen X = `var' // to produce table
	
	if inlist("`var'", "h_female", "h_domain9", "h_network") {
		pdslasso e_domain2 ib6.treatment##ib0.X (i.strata i.wave phone_survey survey_date b_domain2 $cat_list $lik_list $con_list), partial(i.strata i.wave phone_survey survey_date b_domain2) post(pds) robust cluster(ent_id) lopt(prestd)
		eststo h34_`num'
	}
	
	if inlist("`var'", "h_mentor_profit", "h_mentor_exp", "h_mentor_dist") { // Omit the uninteracted control and irrelevant interactions
		pdslasso e_domain2 ib6.treatment 1.treatment#X 2.treatment#X (i.strata i.wave phone_survey survey_date b_domain2 $cat_list $lik_list $con_list), partial(i.strata i.wave phone_survey survey_date b_domain2) post(pds) robust cluster(ent_id) lopt(prestd)
		eststo h34_`num'
	}
	
	drop X		
}

esttab h34_1 h34_2 h34_3 h34_4 h34_5 h34_6 using "$path/Output/Appendix_E/hetero_domain2.tex", label $nostar collabels(none) replace nolines nonumber substitute(\_ _ \$ $) ///
cells(b($stars_b fmt(%9.2f)) se(par fmt(%9.2f)) p(par([ ] ) fmt(%9.2f))) stats(N, fmt(%9.0fc) labels("Observations")) ///
keep(1.treatment 2.treatment 3.treatment 4.treatment 5.treatment 1.X  1.treatment#1.X 2.treatment#1.X 3.treatment#1.X 4.treatment#1.X 5.treatment#1.X) ///
order(5.treatment#1.X 5.treatment 4.treatment#1.X 4.treatment 3.treatment#1.X 3.treatment 2.treatment#1.X 2.treatment 1.treatment#1.X 1.treatment 1.X) ///
coeflabels(1.treatment "Mentored by Ugandan" 2.treatment "Mentored by Refugee" 3.treatment "Grant Only" 4.treatment "Information Only" 5.treatment "Info. + Labeled Grant" 1.X "\textit{X}" 1.treatment#1.X "Mentored by Ugandan $\times$ \textit{X}" 2.treatment#1.X "Mentored by Refugee $\times$ \textit{X}" 3.treatment#1.X "Grant Only $\times$ \textit{X}" 4.treatment#1.X "Information Only $\times$ \textit{X}" 5.treatment#1.X "Info. + Labeled Grant $\times$ \textit{X}") ///
mtitle("\shortstack{Female\\Owner}" "\shortstack{Business\\Practices\\Index}" "\shortstack{Business\\Network\\Size}" "\shortstack{Mentor\\Profit}" "\shortstack{Mentor\\Experience}" "\shortstack{Distance\\to Mentor}") ///
$stars_setup ///
prehead("\begin{table}[h]	\centering	\footnotesize	\caption{Heterogeneity in Treatment Impacts on Business Profit} \label{tab:hetero_domain2}	\begin{tabular}{l*{6}{>{\centering\arraybackslash}p{1.7cm}}}\toprule \toprule ") ///
posthead("\cmidrule{2-7}") ///
prefoot("& & & & & & \\") ///
postfoot("\bottomrule \bottomrule \multicolumn{7}{p{\linewidth}}{\footnotesize The dependent variable for each column is business profits. Each column title lists the dimension of heterogeneity (\textit{X}) that is analyzed in the regression. An observation is a surveyed respondent, with one per post-baseline survey round, in Uganda. Results estimated through ANCOVA regression with baseline controls selected through double-lasso. Standard errors clustered at the enterprise level in parentheses; two-sided $ p $-values in brackets. $stars_note}  \end{tabular} \\ \end{table}%")

estimates drop h34_*



*------------------------------------------------------------------------------------
* Table E32 -- Heterogeneity in Treatment Impacts by Treatment Timing
*------------------------------------------------------------------------------------


eststo timing1: pdslasso e_domain1 ib6.treatment ib6.treatment#treated_v2 ib6.treatment#treated_v2#c.treated_period_v2 (i.strata i.wave phone_survey survey_date b_domain1 $cat_list $lik_list $con_list), partial(i.strata i.wave phone_survey survey_date b_domain1) post(pds) robust cluster(ent_id) lopt(prestd)

eststo timing2: pdslasso e_domain2 ib6.treatment ib6.treatment#treated_v2 ib6.treatment#treated_v2#c.treated_period_v2 (i.strata i.wave phone_survey survey_date b_domain2 $cat_list $lik_list $con_list), partial(i.strata i.wave phone_survey survey_date b_domain2) post(pds) robust cluster(ent_id) lopt(prestd)


esttab timing1 timing2 using "$path/Output/Appendix_E/hetero_timing.tex", label collabels(none) replace nolines nonumber substitute(\_ _ \$ $) ///
$stars_setup ///
cells(b($stars_b fmt(%9.2f)) se(par fmt(%9.2f)) p(par([ ] ) fmt(%9.2f))) stats(N, fmt(%9.0fc) labels("Observations")) ///
keep(1.treatment 2.treatment 3.treatment 4.treatment 5.treatment 1.treatment#1.treated_v2 2.treatment#1.treated_v2 3.treatment#1.treated_v2 4.treatment#1.treated_v2 5.treatment#1.treated_v2 1.treatment#1.treated_v2#c.treated_period_v2 2.treatment#1.treated_v2#c.treated_period_v2 3.treatment#1.treated_v2#c.treated_period_v2 4.treatment#1.treated_v2#c.treated_period_v2 5.treatment#1.treated_v2#c.treated_period_v2) ///
order(5.treatment#1.treated_v2 5.treatment#1.treated_v2#c.treated_period_v2 5.treatment 4.treatment#1.treated_v2 4.treatment#1.treated_v2#c.treated_period_v2 4.treatment 3.treatment#1.treated_v2 3.treatment#1.treated_v2#c.treated_period_v2 3.treatment 2.treatment#1.treated_v2 2.treatment#1.treated_v2#c.treated_period_v2 2.treatment 1.treatment#1.treated_v2 1.treatment#1.treated_v2#c.treated_period_v2 1.treatment) ///
coeflabels(1.treatment "Mentored by Ugandan" 2.treatment "Mentored by Refugee" 3.treatment "Grant Only" 4.treatment "Information Only" 5.treatment "Info. + Labeled Grant" ///
 1.treatment#1.treated_v2 "Mentored by Ugandan $\times$ Treated" 2.treatment#1.treated_v2 "Mentored by Refugee $\times$ Treated" 3.treatment#1.treated_v2 "Grant Only $\times$ Treated" 4.treatment#1.treated_v2 "Information Only $\times$ Treated" 5.treatment#1.treated_v2 "Info. + Labeled Grant $\times$ Treated" ///
 1.treatment#1.treated_v2#c.treated_period_v2 "Mentored by Ugandan $\times$ Treated $\times$ \# Meetings" 2.treatment#1.treated_v2#c.treated_period_v2 "Mentored by Refugee $\times$ Treated $\times$ \# Meetings" 3.treatment#1.treated_v2#c.treated_period_v2 "Grant Only $\times$ Treated $\times$ Months Since Treatment" 4.treatment#1.treated_v2#c.treated_period_v2 "Information Only $\times$ Treated $\times$ Months Since Treatment" 5.treatment#1.treated_v2#c.treated_period_v2 "Info. + Labeled Grant $\times$ Treated $\times$ Months Since Treatment") ///
prehead("\begin{table}[h]	\centering	\footnotesize \caption{Heterogeneity in Treatment Impacts by Treatment Timing} \label{tab:hetero_timing}	\begin{tabular}{l*{2}{>{\centering\arraybackslash}p{3.2cm}}}\toprule \toprule ") ///
posthead("\cmidrule{2-3}") ///
prefoot("& &   \\") ///
postfoot("\bottomrule \bottomrule \multicolumn{3}{p{\linewidth}}{\footnotesize An observation is a surveyed respondent, with one per post-baseline survey round, in Uganda. Results estimated through ANCOVA regression with baseline controls selected through double-lasso. \textit{Treated} is an indicator for having the first visit by NGO staff (Labeled Grant, Information Only, and Grant Only), or for having any mentorship meetings (Mentored by Refugee, Mentored by Ugandan). \textit{Months Since Treatment} is the months between the first visit and the survey. Standard errors clustered at the enterprise level in parentheses; two-sided $ p $-values in brackets. $stars_note}  \end{tabular} \\ \end{table}%")

estimates drop timing1 timing2
